<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Group 5 eBook-Cafe</title>
        <script language="javascript" src="script/ddimgtooltip.js"></script>
        <link rel="stylesheet" type="text/css" href="style/960grid.css"/>
        <link rel="stylesheet" type="text/css" href="style/style-old.css"/>
    </head>
    <body>

        <div id="wrapper" class="container_12">

            <div class="grid_12 alignRight">
                <%
                            String id = (String) session.getAttribute("login");
                            //id = Integer.parseInt(session.getAttribute("login"));

                            if (id != null) {
                                out.println("welcome, user" + id);
                            } else {
                                %>
                                <jsp:include page="loginForm.jsp" />
                <%
                            }
                %>
            </div>

            <div class="grid_12">
                <h1>Group 5 eBook Store</h1>
            </div>

            <div class="grid_12 navigation">
                <a href="">link</a>
                <a href="">link</a>
                <a href="">link</a>
                <a href="">link</a>
                <a href="">link</a>
            </div>
            <div class="clear"></div>

            <div class="grid_2 browsing">

            </div>
            <div class="grid_8 main">
                <h1>Please Login or <a href="register.jsp">Register</a></h1>

                <form method="post" action="Login">
                    email:<input type="text" name="email"><br/>
                    password<input type="text" name="pass"><br/>
                    <input type="submit" value="Login"/>
                </form>
            </div>
            <div class="grid_2 misc">

            </div>
            <div class="clear"></div>

        </div>

        <%
                    //session.addAttribute("login", "<user_id>") // login.
                    //session.removeAttribute("login"); // logout.

                    id = (String) session.getAttribute("login");

                    //id = Integer.parseInt(session.getAttribute("login"));

                    if (id != null) {
        %>
        <h1>Welcome, user <% out.print(id);%></h1>
        <%
                } else {
        %>
        <h1>Please Login or <a href="register.jsp">Register</a></h1>

        <form method="post" action="Login">
            email:<input type="text" name="email"><br/>
            password<input type="text" name="pass"><br/>
            <input type="submit" value="Login"/>
        </form>
        <%                    }
        %>

    </body>
</html>